# # -*- coding:utf-8 -*-
# class Solution:
#     def IsContinuous(self, numbers):
#         # write code here
#         if not numbers:
#             return False
#         numbers.sort()
#         num_zero = 0
#         for i in range(len(numbers) - 1):
#             if not numbers[i]:
#                 num_zero += 1
#             else:
#                 if numbers[i+1] - numbers[i] == 1:
#                     continue
#                 elif numbers[i+1] - numbers[i] == 0:
#                     return False
#                 elif numbers[i+1] - numbers[i] - 1 <= num_zero:
#                     num_zero -= numbers[i+1] - numbers[i] - 1
#                 else:
#                     return False
#         return True
# # -*- coding:utf-8 -*-
class Solution:
    def IsContinuous(self, numbers):
        # write code here
        # 不需要排序的算法
        # 不能重复，最大值最小值之间的差要小于5（不包括0)
        if not numbers:
            return False
        d = [0 for _ in range(14)]# 一共有14个数
        max = 0
        min = 15
        for i in range(len(numbers)):
            if not numbers[i]:
                continue
            d[numbers[i]] += 1
            if d[numbers[i]] > 1:
                return False
            if numbers[i] > max:
                max = numbers[i]
            if numbers[i] < min:
                min = numbers[i]
        return True if max - min < 5 else False